/*
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-08-15 16:45:25
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2022-10-25 01:29:32
 * @FilePath: \grazlink20\uc_sys\src\api\uc\org\index.ts
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved.
 */
import { useAxios } from '@/hooks/web/useAxios'
import type { TableData } from './types'
const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 组织列表
export const ucOrgListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgList',
      data: data
    }
  })
}

// 组织修改
export const ucOrgEditApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgEdit',
      data: data
    }
  })
}

// 组织新增
export const ucOrgAddApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgAdd',
      data: data
    }
  })
}

// 组织删除
export const ucOrgDelApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgDel',
      data: data
    }
  })
}

// 组织批量删除
export const ucOrgBatchDelApi = (data: { ids: string }) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgBatchDel',
      data: data
    }
  })
}

// 组织设置系统角色
export const ucOrgSysRoleSetApi = (data: { ids: string }) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgSysRoleSet',
      data: data
    }
  })
}

// 组织审核
export const ucOrgAdminExamineApi = (data: { ids: string }) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgAdminExamine',
      data: data
    }
  })
}
